<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>QQ登录</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="format-detection" content="telephone=no" />
	<script src="https://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
	<script type="text/javascript" src="//qzonestyle.gtimg.cn/qzone/openapi/qc_loader.js" data-appid="101566586" data-redirecturi="http://yaokui.ltd:9999/qqlogin.html" charset="utf-8"></script>
	<link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
	<script src="/layuiadmin/layui/layui.js"></script>
</head>
<body>
	<div style="margin:50px auto;text-align:center;color:#00bcd4">
		<!-- <h1>success</h1> -->
		<!--<form action="http://yaokui.ltd:8888/teacher/qqloginCheck" method="post" name="myform">-->
			<!--<input type="hidden" id="openid" name="openid"/>		-->
		<!--</form>-->
	</div>
<script type="text/javascript">
    layui.use(['layer', 'form', 'upload'], function(){
        var $ = layui.$
            ,form = layui.form
            ,layer = layui.layer ;
		window.login = function login(openId) {
			$.ajax({
				url: "qqlogin",
				dataType: "json",
				type: "post",
				data: {
					openid: openId
				},
				success: function (data) {
					if (data.status == 1) {
						layui.layer.msg('QQ登录成功', {
							icon: 1
							, time: 1000
						}, function () {
							location.href="/index";
						});
					}
					else if (data.status == 0) {
						layer.msg('QQ登录失败', {
							icon: 0
							, time: 1000
						});
					}
				},
				error: function (result) {
					console.log(result);
					alert("系统繁忙！");
				}
			});
		}

        QC.Login.getMe(function(openId, accessToken){
            // $("#openid").val(openId);
            login(openId);
        });

    });
</script>
</body>
</html>